package g.dev.xtable;

import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class User {
	private long id;
	private String firstName;
	private String lastName;
	private String userName;
	private int age;

	public User (long id, String firstName, String lastName, String userName) {
		this.id = id;
		this.firstName = firstName;
		this.lastName = lastName;
		this.userName = userName;
	}

	public User () {
		// TODO Auto-generated constructor stub
	}

	public long getId () {
		return id;
	}

	public void setId (long id) {
		this.id = id;
	}

	

	public boolean equals (Object object) {
	    if (object instanceof User) {
	        return id == ((User) object). id;
	    }
	    return false;
	}

	public static User empty () {
		return new User ();
	}

	public int getAge () {
		return age;
	}

	public void setAge (int age) {
		this.age = age;
	}
//	private Connection conn;
//	  
//	  public User(Connection conn) {
////	    super();
//	    this.conn = conn;
//	  }
//
//	  public void addUser(int id, String name, Date birthday) throws SQLException {
//	    PreparedStatement ps = conn.prepareStatement("insert into user (id, name, birthday) values (?,?,?)");
//	    try {
//	      ps.setInt(1, id);
//	      ps.setString(2, name);
//	      ps.setDate(3, birthday);
//	      ps.executeUpdate();
//	    } finally {
//	      ps.close();
//	    }
//	  }

	/**
	 * @return the firstName
	 */
	public String getFirstName() {
		return firstName;
	}

	/**
	 * @param firstName the firstName to set
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * @return the lastName
	 */
	public String getLastName() {
		return lastName;
	}

	/**
	 * @param lastName the lastName to set
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * @return the userName
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * @param userName the userName to set
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}


}
